<template>
  <div>
    Home page
    <h2>{{ message }}</h2>

    <h2>{{ title }}</h2>
    <h2>当前计数: {{ state.counter }}</h2>
    <button @click="increment">点击按钮+1</button>
  </div>
</template>

<script>
import { reactive } from "vue";
export default {
  props: {
    message: {
      type: String,
      required: true,
    },
  },
  setup() {
    let state = reactive({
      counter: 100,
    });
    //局部函数
    const increment = () => {
      state.counter++;
      console.log(state.counter, "increment");
    };
    return {
      title: "Hello Vue3",
      state,
      increment,
    };
  },
};
</script>

<style scoped>
</style>